import React, { Component } from 'react'
import {
    BrowserRouter,
    Switch,
    Route,
    Redirect
} from 'react-router-dom'
import App from '../page/App'
import Login from '../page/login'
import shopDetail from '../page/shopDetail'
import cart from '../page/cart'
import map from '../page/map'
import chat from '../page/chat'

export default class Router extends Component {
    render() {
        return (
            <BrowserRouter>
                <Switch>
                    <Route path='/app' component={App} /> {/*主页面*/}
                    <Route path='/login' component={Login} />  {/*登录页面*/}
                    <Route path='/shopDetail' component={shopDetail} /> {/*商城详情*/}
                    <Route path='/cart' component={cart} /> {/*购物车*/}
                    <Route path='/map' component={map} /> {/*地图*/}
                    <Route path='/chat' component={chat} /> {/*聊天室*/}
                    <Redirect from='/' to='app' />
                </Switch>
            </BrowserRouter>
        )
    }
}
